package com.ubank.accmanager.util;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class Record extends SQLiteOpenHelper {
	private final static int DATABASE_VERSION = 1;
	private final static String DATABASE_NAME = "ubank1.db";

	public Record(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		String sqlTable = "CREATE TABLE [t_record] "
				+ "(_id INTEGER DEFAULT '1' NOT NULL PRIMARY KEY AUTOINCREMENT,"
				+ "actNo TEXT NOT NULL," + "actType TEXT NOT NULL,"
				+ "actAlias TEXT," + "reason TEXT," + "netlocation TEXT,"
				+ "place TEXT) ";
		db.execSQL(sqlTable);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub

	}

	public void insert(Object[] args) {
		// TODO Auto-generated method stub
		this.getWritableDatabase()
				.execSQL(
						"INSERT INTO t_record (actNo , actType , actAlias , reason, netlocation, place) VALUES(?,?,?,?,?,?)",
						args);
	}

}
